#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "HuJiang";

from entity.news import *;
from datetime import datetime;

'''
新闻对象数据存储
'''

def save_news_list(title_list=[], content_list=[]):
    for index, item in enumerate(title_list):
        # 1860年5月11日 世界史上著名的“千人军”开始远征'
        content = "";
        for line in content_list[index].split("\u3000\u3000"):
            content = "%s<p>%s</p>" % (content, line);

        news = News(
            occur_date=datetime.strptime(item.split(" ")[0], "%Y年%m月%d日"),
            subject=item.split(" ")[1],
            content=content,
            create_date=datetime.now().strftime("%Y-%m-%d %H:%M:%S")
        );

        print(news.__dict__);
        insert_(news, "subject");